<template>
  <div>
    <table>
      <tr>
        <td>标题</td>
        <td>图片</td>
        <td>分类名称</td>
      </tr>
      <tr v-for='i in list'>
        <td>{{ i.title }}</td>
        <td><img :src='i.pic'></td>
        <td>{{ i.name }}</td>
      </tr>
    </table>
    <page1 :total='total' :page_size='page_size' @cpage='getpage'/>
  </div>
</template>
<script>
import page1 from './page1'

export default {
  components: {
    'page1': page1
  },
  data() {
    return {
      list: [],
      total: 0,
      page: 1,
      page_size: 2
    }
  },
  methods: {
    getlist() {
      this.axios.get('courseM?page=' + this.page).then(res => {
        this.list = res.data.list
        this.total = res.data.total
      })
    },
    //父组件接收子组件的值
    getpage(p) {
      this.page = p
      this.getlist()
    }
  },
  mounted() {
    this.getlist()
  },
}
</script>
<style lang="">

</style>
